﻿using System.Collections.Generic;
using System.IO;
using System.Linq;
using SuperShell.Common.LinqExtensions;

namespace SuperShell.Utils.FileSystem
{
	public static class FileSystemUtils
	{
		public static IEnumerable<FileSystemInfo> GetFilesList(string path)
		{
			var di = new DirectoryInfo(path);
			var infos = di.GetFileSystemInfos()
				.Split(fsi => (fsi.Attributes & FileAttributes.Directory) == FileAttributes.Directory);

			return infos.Select(inf => inf.OrderBy(i => i.Name)).SelectMany(i => i);
		}
	}
}
